import request from '@/config/axios'
import {data} from "autoprefixer";

// 表单数据 VO
export interface FormDataVO {
  content: string // 内容
  appDsgnId: number // 关联设计表ID
  formDsgnId: number // 表单设计主键ID
  formType: number // 表单类型
  ownerCode: string // 表单归属对象所属主键Code
  ownerName: string // 表单归属对象所属主键Name
  persistenceType: number // 持久化模式 0：json；1结构化
  persistenceCode: string // 持久化对应存储的主键Code
  persistenceName: string // 持久化对应存储的主键Name
  status: number // 状态
  id: number // id
}

// 表单数据 API
export const FormDataApi = {
  // 查询表单数据分页
  getFormDataPage: async (params: any) => {
    return await request.get({ url: `/res/form-data/page`, params })
  },

  // 查询表单数据详情
  getFormData: async (id: number) => {
    return await request.get({ url: `/res/form-data/get?id=` + id })
  },

  // 新增表单数据
  createFormData: async (data: FormDataVO) => {
    return await request.post({ url: `/res/form-data/create`, data })
  },

  // 修改表单数据
  updateFormData: async (data: FormDataVO) => {
    return await request.put({ url: `/res/form-data/update`, data })
  },

  // 删除表单数据
  deleteFormData: async (id: number) => {
    return await request.delete({ url: `/res/form-data/delete?id=` + id })
  },

  // 导出表单数据 Excel
  exportFormData: async (params) => {
    return await request.download({ url: `/res/form-data/export-excel`, params })
  },
  // 表单记录
  formRecord: async (data) => {
    return await request.post({ url: `/res/form-data/form-record`, data })
  },
  /**
   * 获取表单记录
   * @param data
   */
  getFormListPage: async (data) => {
    return await request.postOriginal({ url: `/dynamic/get`, data })
  },

  /**
   * 获取表单记录
   * @param data
   */
  getFormColumns: async (data) => {
    return await request.post({ url: `/res/form-data/formColumns`, data })
  },

  getSerialNumber:async (data)=> {
    return await request.post({ url: `/form-control/getSerialNumber`, data })
  },
  // 表单记录
  formSubmitReg: async (data) => {
    return await request.post({ url: `/res/form-data/form-submit_reg`, data })
  },
}
